package com.songbl.bless.app.job;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;


public class BlessJob implements Job {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    MailService mailService;

    @Override
    public void execute(JobExecutionContext context)  {
        System.out.println("BlessJob 任务执行");
        logger.error("BlessJob 任务执行");
    JobDataMap map = context.getJobDetail().getJobDataMap();
    String to = map.getString("to");
    String subject = map.getString("subject");
    String content = map.getString("content");
    System.out.println("发送邮件"+to+subject+content);
    mailService.sendSimpleTextMail(to, subject, content);

    }
}
